/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-05-12 10:52:22
 * @LastEditors: voanit
 * @LastEditTime: 2022-05-14 09:21:24
 */
import axios from 'axios'
export const add = (payload) => {
  //   return { type: 'todos/add', payload }
  const fn = async (dispatch) => {
    const res = await axios({
      method: 'POST',
      url: 'https://www.fastmock.site/mock/74f9d773e725851c64a71332d919de0c/books/api/testpost',
    })

    console.log(res)

    dispatch({ type: 'todos/add', payload })
  }

  return fn
}

export const action1 = async (dispatch) => {
  // console.log(111)
  const res = await axios(
    'https://apipc-xiaotuxian-front.itheima.net/home/category/head'
  )
  // console.log(res, 444)
  dispatch({ type: 'add/head', payload: res.data.result })
}
